package com.ticket.sass.provider.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ticket.sass.common.entity.provider.TenantEntity;
import com.ticket.sass.provider.mapper.TenantMapper;
import com.ticket.sass.provider.service.BaseService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ywb
 * @since 2024-03-18
 */
@Service
public class TenantServiceImpl extends ServiceImpl<TenantMapper, TenantEntity> implements BaseService<TenantEntity> {
    public List<String> getAllKeys() {
        QueryWrapper<TenantEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("key");
        List<Object> keyObjects = this.listObjs(queryWrapper);
        
        // 转换 Object 列表为 String 列表
        return keyObjects.stream()
            .filter(obj -> obj instanceof String)
            .map(Object::toString)
            .collect(Collectors.toList());
    }
}
